package edu.sctu.practice.class02.yangshengyu.text01.test04;

/**
 * Created by Cullen on 2015/10/12.
 */
public class Number {
    private static int n1;
    private static int n2;

    public Number(int val1, int val2) {
        n1 = val1;
        n2 = val2;
    }

    public int addition() {    //和方法
        return n1 + n2;
    }

    public int subtration() {   //差方法
        return n1 - n2;
    }

    public int multiplication() {   //乘积方法
        return n1 * n2;
    }

    public double division() {    //商方法
        return (double) n1 / (double) n2;
    }

    public static void main(String[] args) {
        Number number = new Number(4, 6);   //创建对象

        System.out.println(n1 + "和" + n2 + "的和为：" + number.addition());

        System.out.println(n1 + "和" + n2 + "的差为：" + number.subtration());

        System.out.println(n1 + "和" + n2 + "的乘积为：" + number.multiplication());

        System.out.println(n1 + "和" + n2 + "的商为：" + number.division());


    }
}
